{% extends "base.html" %}

{% block content %}
<div class="row">
    <div class="col-md-12 mb-4">
        <h2>编辑技能标签</h2>
    </div>
</div>

<div class="row">
    <div class="col-md-8">
        <div class="card">
            <div class="card-header bg-primary text-white">
                <h5 class="mb-0">编辑 "{{ skill.name }}"</h5>
            </div>
            <div class="card-body">
                <form action="" method="post" novalidate>
                    {{ form.hidden_tag() }}
                    <div class="mb-3">
                        {{ form.name.label(class="form-label") }}
                        {{ form.name(class="form-control") }}
                        {% for error in form.name.errors %}
                        <div class="text-danger">{{ error }}</div>
                        {% endfor %}
                    </div>
                    
                    <div class="d-flex justify-content-between">
                        <a href="{{ url_for('skills.index') }}" class="btn btn-outline-secondary">取消</a>
                        {{ form.submit(class="btn btn-primary") }}
                    </div>
                </form>
            </div>
        </div>
    </div>
    
    <div class="col-md-4">
        <div class="card mb-4">
            <div class="card-header bg-primary text-white">
                <h5 class="mb-0">提示</h5>
            </div>
            <div class="card-body">
                <p>修改技能标签名称将影响所有关联此技能的用户档案和文章。</p>
                <p>请确保新名称能够准确表达相同的技能或知识领域。</p>
            </div>
        </div>
        
        <div class="card">
            <div class="card-header bg-primary text-white">
                <h5 class="mb-0">统计信息</h5>
            </div>
            <div class="card-body">
                <p><strong>拥有此技能的成员:</strong> {{ skill.users|length }} 名</p>
                <p><strong>关联此技能的文章:</strong> {{ skill.articles|length }} 篇</p>
                <div class="d-grid gap-2">
                    <a href="{{ url_for('skills.users', id=skill.id) }}" class="btn btn-outline-primary">查看相关成员</a>
                    <a href="{{ url_for('articles.by_skill', skill_id=skill.id) }}" class="btn btn-outline-primary">查看相关文章</a>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}